// -*- C++ -*-
header {
#include <string.h>
}

token {
	IDENTIFIER;
	PREDICATES;
	CLAUSES;
	GOAL;
	INTEGER;
	REAL;
	STRING;
	SYMBOL;
	CHAR;
	UNDERSCORE;
	LN;
	LOG;
	SQRT;
	ABS;
	EXP;
	SIN;
	COS;
	TAN;
	ARCTAN;
	TRUNC;
	ROUND;
	PLUS;
	MINUS;
	MULTIPLY;
	DIVIDE;
	DIV;
	MOD;
	GREAT;
	LESS;
	GREAT_EQUALS;
	LESS_EQUALS;
	EQUALS;
	NOT_EQUALS;
	CURLY_BRACKET_OPEN;
    CURLY_BRACKET_CLOSE;
	BRACKET_OPEN;
	BRACKET_CLOSE;
	PARENTHESIS_OPEN;
	PARENTHESIS_CLOSE;
	POINT;
	COMMA;
	SEMICOLON;
	COLONDIF;
	CONST_STRING;
	CONST_CHAR;
	INTEGER_NUMBER;
	REAL_NUMBER;
	VARIABLE;
}

mode ONE_AND_ONLY
{
    <<EOF>>     => QUEX_TKN_TERMINATION;

    [ \t\r\n]+	{ }
	[%].*		{ }

	"predicates"	=> QUEX_TKN_PREDICATES;
	"clauses"		=> QUEX_TKN_CLAUSES;
	"goal"			=> QUEX_TKN_GOAL;


	"integer"	=> QUEX_TKN_INTEGER;
	"real"		=> QUEX_TKN_REAL;
	"string"	=> QUEX_TKN_STRING;
	"symbol"	=> QUEX_TKN_SYMBOL;
	"char"		=> QUEX_TKN_CHAR;


	"ln"			=> QUEX_TKN_LN;
	"log"			=> QUEX_TKN_LOG;
	"sqrt"			=> QUEX_TKN_SQRT;
	"abs"			=> QUEX_TKN_ABS;
	"exp"			=> QUEX_TKN_EXP;
	"sin"			=> QUEX_TKN_SIN;
	"cos"			=> QUEX_TKN_COS;
	"tan"			=> QUEX_TKN_TAN;
	"arctan"		=> QUEX_TKN_ARCTAN;
	"trunc"			=> QUEX_TKN_TRUNC;
	"round"			=> QUEX_TKN_ROUND;
	"random"		=> QUEX_TKN_RANDOM;


	"+"			=> QUEX_TKN_PLUS;
	"-"			=> QUEX_TKN_MINUS;
	"*"			=> QUEX_TKN_MULTIPLY;
	"/"			=> QUEX_TKN_DIVIDE;
	"div"		=> QUEX_TKN_DIV;
	"mod"		=> QUEX_TKN_MOD;


	">"		=> QUEX_TKN_GREAT;
	"<"		=> QUEX_TKN_LESS;
	">="	=> QUEX_TKN_GREAT_EQUALS;
	"=<"	=> QUEX_TKN_LESS_EQUALS;
	"="		=> QUEX_TKN_EQUALS;
	"<>"	=> QUEX_TKN_NOT_EQUALS;


	"{"		=> QUEX_TKN_CURLY_BRACKET_OPEN;
    "}"		=> QUEX_TKN_CURLY_BRACKET_CLOSE;
	"["		=> QUEX_TKN_BRACKET_OPEN;
	"]"		=> QUEX_TKN_BRACKET_CLOSE;
	"("		=> QUEX_TKN_PARENTHESIS_OPEN;
	")"		=> QUEX_TKN_PARENTHESIS_CLOSE;
	"."		=> QUEX_TKN_POINT;
	","		=> QUEX_TKN_COMMA;
	":-"	=> QUEX_TKN_COLONDIF;
	";"		=> QUEX_TKN_SEMICOLON;

	[0-9]+\.[0-9]+	{self_send1(QUEX_TKN_REAL_NUMBER, Lexeme);RETURN;}
	[0-9]+			{self_send1(QUEX_TKN_INTEGER_NUMBER, Lexeme);RETURN;}

	[A-Z][A-Za-z0-9_]*		{self_send1(QUEX_TKN_VARIABLE, Lexeme);RETURN;}
	[a-z][A-Za-z0-9_]*		{self_send1(QUEX_TKN_IDENTIFIER, Lexeme);RETURN;}
	[_][A-Za-z0-9_]+		{self_send1(QUEX_TKN_IDENTIFIER, Lexeme);RETURN;}
	"_"						=> QUEX_TKN_UNDERSCORE;
	[\"][^\"]*[\"]			{self_send1(QUEX_TKN_CONST_STRING, Lexeme);RETURN;}
	['].[']					{self_send1(QUEX_TKN_CONST_CHAR, Lexeme);RETURN;}
}